const express = require("express");
const router = express.Router();
const roleService = require("./service/roleServiceImpl");

// 新增修改角色
router.post("/saveOrUpdate", (req, res, next) => {
  roleService.saveOrUpdate(req, res, next);
});

// 获取角色列表
router.post("/getTree", (req, res, next) => {
  roleService.getTree(req, res, next);
});

// 删除角色 需先删除下级角色
router.post("/deleteWithoutSub", (req, res, next) => {
  roleService.deleteWithoutSub(req, res, next);
});

// 删除角色 会删除所有下级角色
router.post("/deleteAllSub", (req, res, next) => {
  roleService.deleteAllSub(req, res, next);
});

// 绑定菜单
router.post("/bindMenu", (req, res, next) => {
  roleService.bindMenu(req, res, next);
});

// 获取角色的菜单信息
router.post("/getRoleMenu", (req, res, next) => {
  roleService.getRoleMenu(req, res, next);
});

module.exports = router;
